package com.example.demo.common.com.example.demo;

import java.util.ArrayList;
import java.util.Iterator;

public class fx_demo01 {

    public static void main(String[] args) {

        ArrayList<String> a1 = new ArrayList<String>();
        a1.add("a");
        a1.add("b");
        a1.add("c");

        ArrayList<Integer> a2 = new ArrayList<Integer>();
        a2.add(1);
        a2.add(2);
        a2.add(3);

        printList(a1);

        printList(a2);

        System.out.println("=======================================");

        printList2(a1);

        printList2(a2);

        System.out.println("=======================================");

        fx_utils.print(a1);

        fx_utils.print(a2);

        System.out.println("=======================================");

        fx_utils.print2(a1);

        fx_utils.print2(a2);

    }

    public static void printList(ArrayList list) {
        for (Iterator iterator = list.iterator(); iterator.hasNext(); ) {
            Object object = (Object) iterator.next();
            System.out.println(object);
        }
    }

    public static <T> void printList2(ArrayList<T> list) {
        Iterator<T> iterator = list.iterator();
        while(iterator.hasNext()){
            T t = iterator.next();
            System.out.println(t);
        }
    }



}



